package com.ruoyi.project.system.detail.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.security.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.detail.mapper.ScoreDetailMapper;
import com.ruoyi.project.system.detail.domain.ScoreDetail;
import com.ruoyi.project.system.detail.service.IScoreDetailService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 得分明细Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-02-22
 */
@Service
public class ScoreDetailServiceImpl implements IScoreDetailService 
{
    @Autowired
    private ScoreDetailMapper scoreDetailMapper;

    /**
     * 查询得分明细
     * 
     * @param id 得分明细ID
     * @return 得分明细
     */
    @Override
    public ScoreDetail selectScoreDetailById(Long id)
    {
        return scoreDetailMapper.selectScoreDetailById(id);
    }

    /**
     * 查询得分明细列表
     * 
     * @param scoreDetail 得分明细
     * @return 得分明细
     */
    @Override
    public List<ScoreDetail> selectScoreDetailList(ScoreDetail scoreDetail)
    {
        return scoreDetailMapper.selectScoreDetailList(scoreDetail);
    }

    /**
     * 新增得分明细
     * 
     * @param scoreDetail 得分明细
     * @return 结果
     */
    @Override
    public int insertScoreDetail(ScoreDetail scoreDetail)
    {
        scoreDetail.setCreateTime(DateUtils.getNowDate());
        scoreDetail.setCreateBy(ShiroUtils.getLoginName());
        return scoreDetailMapper.insertScoreDetail(scoreDetail);
    }

    /**
     * 修改得分明细
     * 
     * @param scoreDetail 得分明细
     * @return 结果
     */
    @Override
    public int updateScoreDetail(ScoreDetail scoreDetail)
    {
        scoreDetail.setUpdateTime(DateUtils.getNowDate());
        scoreDetail.setUpdateBy(ShiroUtils.getLoginName());
        return scoreDetailMapper.updateScoreDetail(scoreDetail);
    }

    /**
     * 删除得分明细对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteScoreDetailByIds(String ids)
    {
        return scoreDetailMapper.deleteScoreDetailByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除得分明细信息
     * 
     * @param id 得分明细ID
     * @return 结果
     */
    @Override
    public int deleteScoreDetailById(Long id)
    {
        return scoreDetailMapper.deleteScoreDetailById(id);
    }

    /**
     * 根据主分表id来批量删除
     * @param scoreMainIds
     * @return
     */
    @Override
    public int deleteScoreDetailByscoreMainIds(String scoreMainIds) {
        return scoreDetailMapper.deleteScoreDetailByscoreMainIds(Convert.toStrArray(scoreMainIds));
    }
}
